<?php
/**
 * Eleven_Form_Login
 * 
 * The login form
 * 
 */
class Eleven_Form_User_Login extends Zend_Form
{
    public function init()
    {               
    	$this->setDisableLoadDefaultDecorators(true);
        $this->setDecorators(array(
            array(
                'ViewScript',
                array('viewScript'=>'index/_login.phtml')
            ),
            'Form'
        ));
        
        $this->addElement('text', 'username', array(
            'validators' => array(
                array('StringLength', true, array(3, 128)),
            ),
            'required'   => true,
            'label'      => '用户名：',
        ));
        $this->getElement('username')->setAttrib('size',11);
        $this->getElement('username')->setDecorators(array(
            'ViewHelper',
 		    'Errors',
        ));
        
        $this->addElement('password', 'passwd', array(
            'filters'    => array('StringTrim'),
            'validators' => array(
                array('StringLength', true, array(6, 128))
            ),
            'required'   => true,
            'label'      => '密码：',
        ));
        $this->getElement('passwd')->setAttrib('size',11);
        $this->getElement('passwd')->setDecorators(array(
            'ViewHelper',
 		    'Errors',
        ));

        $this->addElement('submit', 'login', array(
            'required' => false,
            'ignore'   => true,
            'label'    => '登陆',
        ));

    }
}
